Learn to Code with Soccer

Python. Pandas. Web Scraping. Databases. SQL. Machine Learning. APIs.

All applied to Soccer data

Soccer is a great gateway to coding

Python. Pandas. Web Scraping. Databases. SQL. Machine Learning. APIs.

All applied to Soccer data

Learning to code isn't hard, you just need to stick with it a bit. That's why the most important thing is starting with a project you're excited about.

This book will take you from playing around with stats in Excel to scraping websites, building databases and running your own machine learning models.

30 day money back guarantee!
logo

“This book was really, really well done.”

Bill Connelly
ESPN

Learn How to Do Your Own Soccer Analysis in Python

You'll learn — step by step and applied to soccer — how to program your own analysis. You'll also learn how to make plots like these 👇:
shot type heatmapspeed vs spin ratepitches by inningshot distance per period

☝️ with 2 lines of code!

“Amazingly awesome... the way the learning is framed here is 10x what you'll get someplace else.”

u/Nick58
Reddit

What People Are Saying

About this and related other sport versions —

"The book here was really, really well done......"

— Bill Connelly

"This is amazingly awesome. I’ve recently slowly crept into data science driven by a pet passion for fantasy sport analytics. ...the way the learning is framed here is 10x what you’ll get someplace else...."

— u/Nick58

"...probably the best / most complete Pandas walk through I've seen."

— Bill S

"I really loved your book. You did an amazing job on it. ... I've been trying to get my son more into programming, and your book has been perfect... really clicked for him."

— John M

"Fantastic... literally feels like it was written for me!"

— u/MurrayInBocaRaton

"...picked up more, and at a better pace, using this than a lot of the free online tools I’d been trying the past few months."

— Ryan P

"Love the book... My python has come a very long way thanks to you."

— u/TomatoHead7

"I have always wanted to learn a language but always seemed to get discouraged by the 'Hello World' chapters that were never ending. I like that your book cuts out the riff raff and teaches the important things! I'm flying through the book and feel like I'm learning a ton! Best wishes from a satisfied customer."

— Jason K

"I have tons of coding books. Yours is a favorite"

— Craig M

"Dear Nate, I'd like to thank you for a brilliant book. ... It's distilled, without extra and unnecessary... info and challenging at the same time. I'm writing you just to thank you."

— Murat S

"Loving this so far!""

— Steve S

"...much more engaging for me personally because it’s info I’m interested in. I’ve taken automate the boring stuff, python for finance, etc and while those courses are great.. I seem to be understanding it better because its about a subject I like."

— u/financenstuff

"...exactly the course I was looking for a long time! :)"

— Marco C

"I really like your approach to teaching data science! I usually work with... R, and your book is one of the resources I'm using to teach myself Python... So far it's the best one!"

— Hanwei S

"The only Python course that's kept me engaged from beginning to end."

— Michael G

"Been loving your book so far, it progresses at a great pace and has easily been the best mode I've used to understand coding. I'm excited to learn more, thank you for creating this book that's allowing me to have fun learning again, it's been ages."

— Kevin B

"...absolutely superb... definitely understand the acclamation"

— Jaeho Y

"...really helpful and a fun way to learn."

— Brian D

"You're an absolute legend!"

— Durand S

"I am enjoying refreshing my Python knowledge with your book very much."

— Dan V

"I am going through your book right now... and I love it!"

— Cinoon B

"I bought LTCWFF and love it!"

— Todd B

"...so helpful and enjoyable."

— Ryan C

"The book is great!"

— Steffen L

"... helped me way more than my grad school class did."

— Glen I

"Thank you Nathan ... You ARE an amazing teacher!"

— Urshita G

"Can I just say that this is the simplest and best explanation I have ever seen ... Awesome!!"

— Stu T

"I was amazed by how you broke down complicated concepts and made them easier to understand."

— Ryan C

"I can't tell you how many times I've tried to get into programming and gave up because it was so dry. This has been such a nice change of pace and I'm loving it."

— Paval M

"I just bought your book and have to say I enjoy it immensely so far."

— Tim Y

"...exactly what I needed to finally get past tutorial hell and apply Python to something I love."

— Philip D

"it's been great refreshers for basic Python... I appreciate the Anki cards ... they're helping cement the terminology..."

— u/michaelmanieri

"...it helped me tremendously ... I wouldn't be where I'm at with the Python language today without this book to kick start things."

— u/F1rstxLas7

"...very engaging so far compared to some of the other online resources I've tried to pick this up with."

— Tim M

"...could not be more satisfied with the content. ...it has been great to work through your in-depth examples learning new skills. I had a previous interest in this sort of analysis and have had intermediate programming experience, but never could tie the two together."

— Owen B

"Incredible work! Bought it right away. Only 3 chapters in and this book is already better than expected. Worth every penny. Thank you!"

— u/TheMotizzle

"...can definitely recommend it. It's so much easier learning coding with a subject that is familiar and one is passionate about. Thank you!"

— u/scrabas

"I’m flying through your book and loving every bit of it so far. The way you lay everything out is incredibly intuitive and easy to follow."

— Charlie P

“I was amazed by how you broke down complicated concepts and made them easier to understand.”

u/financenstuff
Reddit

New! Companion book on computer tooling out now!

Get the most from your tools

This 228 page companion to Learn to Code with Soccer is an opinionated guide on being maximally productive with your computer.

It includes all setup files, assumes no prior knowledge and covers:

  • the terminal and shell commands
  • text editing and notetaking with Vim
  • backing up and quickly protyping with Git
  • setting up your own server
  • Chat GPT
  • and more!

Comes with step by step setup instructions and configuration files for Windows, Mac and Chromebook computers.

You can read it before Learn to Code with Soccer, after, or even by itself.

In fact much of the book — which covers building "second brain" notetaking setup and using it with Chat GPT — is useful even to non-coders!

“Fantastic... literally feels like it was written for me!”

u/MurrayInBocaRaton
Reddit

Get the books

Soccer + Tooling Book Bundle

Product information

$158$119USD

Get both Learn to Code with Soccer (and files, flashcards, etc) and the Tech Tools tooling book. Includes a section on using them together.

Spend some time on tooling to get more efficient, then fly through everything else.

  • Learn to Code with Soccer

  • Tech Tools Computer Tooling Book

  • A section on using the two books together

  • Lifetime updates

Book cover
Book cover

30 day money back guarantee!

Learn to Code with Soccer

Product information

$79USD

Python. Pandas. SQL. Machine Learning — all with T20 cricket data. Includes:

  • The 300+ page book in PDF format

  • 300+ spaced repitition flash cards

  • 23 example scripts, 10 datasets

  • 100+ practice problems with full solutions

  • lifetime updates

Book cover

30 day money back guarantee!

Tech Tools

Product information

$79USD

Maximize your productivity with this guide to key computer tools. Covers the terminal, Vim, Chat GPT, Git, servers, building a 'second brain' note taking setup and more.

Can be read before, after, or separate from LTCWS. Includes:

  • The 225 page book in PDF format

  • Windows, Mac, and ChromeOS Setup Configuration Files

  • Interactive tutorial

  • Lifetime updates

Book cover

30 day money back guarantee!

30 Day Money Back Guarantee

Try it! If you're not satisified, contact me within 30 days and I'll refund you the purchase price.

“I've taken automate the boring stuff, python for finance, etc and while those course are great... I seem to be understanding it better because its about a subject I like.”

u/financenstuff
Reddit

Frequently Asked Questions

I'm thinking about buying the book —

I already bought it —

Answers —

"Do I need any coding experience?"

No! The book assumes no prior knowledge, and many people have gone through it with zero coding experience and done just fine.

That said, it does move fast and build on itself, so if you're new you might just have to take it slower and make sure you understand each section before continuing. It includes end-of-chapter problems and exercises that you can use to do that, so it's not hard.


"Do I need any special software?"

We'll learn Python, which is a free, open-source program. Detailed installation instructions are included.

The book includes some optional spaced repetition flashcards to help you remember what you've learned. The official iPhone app to use these costs $25 (it's free on Android). It's worth it IMO, but I describe workarounds if you don't want to pay this.


"Can I give this as a gift?"

Yes! Go here. You'll be able to enter the recipient's name and email. You'll get a link you can send them that they'll be able to redeem for a copy of the book at their convenience.


"Is this book good for kids?"

I've heard of kids as young as 12 working through and liking the book. It doesn't require any prior knowledge, and I explain even relatively simple concepts like "data". That said, the book does build on itself and moves pretty quickly.

In general, if you have a smart kid who is into sports, it's not only doable, but fun. I'm always available to answer any questions too.


"I'm not sure which sport to get — is there a deal if I buy more than one?"

Besides soccer, I also have baseball, American football, basketball and hockey versions.

They all teach the same, general purpose data and analysis concepts. For most people, reading just one will be fine. That said, there are some differences, particularly around the where to get data and in the API chapters.

Additional sports are 50% off. You can find more info and purchase multiple books here.


"Can I expense this for work?"

Probably! Many people have.

Although you'll learn all these concepts (Python, SQL, data manipulation, visualization, and modeling) via soccer, you'll 100% be able to apply these concepts to other areas, including your day job.

This is exactly what I did. I taught myself to code by playing around with fantasy football stats on nights and weekends. Then I used that — without going back to school or to a programming bootcamp — to get multiple data science jobs (both at a startup and a larger company) in non-sports fields.

Company/multi license discounts are available too. Email me and I'm happy to help.


"Do you offer a physical book?"

At the moment the book is only available in an electronic format. This is primarily for two reasons:

  1. It lets me keep it updated. Lifetime updates are included with purchase.
  2. It is meant to be coded along with. Ideally, you would have it up in one monitor and your Python setup on another.

That said, I might make a physical version someday. And I have had some readers take it to a print shop and have them print it out and bind it.


"Where do I get the files?"

See the prerequisites section of the book. But they're at:


"Does this include updates? How do I get them?"

Yes! The book includes lifetime updates. If I update the book — whether it's to fix a typo, make a section clearer or because something changed with one of the libraries — I upload the newest version to SendOwl, and reset everyone's number of downloads.

If it's a significant change (e.g. a library has changed or I fixed something that was broken) I'll send an email about it. If it's just a typo, I usually don't in order to avoid sending too many emails.

You can follow along with all the changes on GitHub. If you bought the book a while ago and are picking it up, it's a good a idea grab the newest version.


"I want to copy/make notes on the text, but it's asking for a password."

The site I use to everything send everything out (SendOwl) password protects it automatically. I've asked them about it but they said it's random and not even they know it.

Some readers and I have figured out a way around it, it just involves some manual work — if it's a problem email me and I'm happy to help.

“I wouldn't be where I'm at with the Python language today without this to book to kick start things.”

u/F1rstxLas7
Reddit

What will you learn?

Python — This flexible language is the foundation of everything from data munging to web scraping to machine learning. You'll also learn about its key data library Pandas, the modeling and machine learning libraries statsmodels and scikit-learn, and how to do data visualizations with seaborn.

Web Scraping and APIs — Next time you run across a site with data you'd like to analyze you'll know how to grab data via its public API if it's available, or build a web scraper to get it yourself if it's not.

Machine Learning and Statistics — You'll learn the difference between a regression and a random forest, and will know when and how to build both.

Databases and SQL — Build your own database — whether it's for player statistics, to keep track of opponent tenancies, etc — and use SQL to get data in and out of it.

All in the context of soccer and designed so you can learn how to apply them to your own questions and do your own analysis.

About the author

profile

Hi! My name is Nate and I'm a self-taught programmer and data scientist based in Milwaukee, WI.

A few years ago, I didn't know anything about Python, SQL, machine learning, web scraping or any of the other topics covered here.

So, I taught myself. It took a few years and I ran into a lot of dead ends along the way, but ultimately I figured it out. In this book, I distill everything I've learned to provide a step-by-step guide to doing soccer analytics and get you up and running as quickly as possible.